Fixed warning click-v8.2.0 about duplicate parameter --tokens#19
Open
pandu-rao wants to merge 1 commit intosimonw:mainfrom
Open
Fixed warning click-v8.2.0 about duplicate parameter --tokens#19pandu-rao wants to merge 1 commit intosimonw:mainfrom
pandu-rao wants to merge 1 commit intosimonw:mainfrom
Conversation
|
@simonw any chance you would accept this? Running amonshiz@m3-air ; uv tool install ttok
Resolved 9 packages in 17ms
Installed 9 packages in 6ms
+ certifi==2025.6.15
+ charset-normalizer==3.4.2
+ click==8.2.1
+ idna==3.10
+ regex==2024.11.6
+ requests==2.32.4
+ tiktoken==0.9.0
+ ttok==0.3
+ urllib3==2.5.0
Installed 1 executable: ttok
amonshiz@m3-air ; ttok --help
/Users/amonshiz/.local/share/uv/tools/ttok/lib/python3.13/site-packages/click/core.py:1193: UserWarning: The parameter --tokens is used more than once. Remove its duplicate as parameters should be unique.
parser = self.make_parser(ctx)
/Users/amonshiz/.local/share/uv/tools/ttok/lib/python3.13/site-packages/click/core.py:1186: UserWarning: The parameter --tokens is used more than once. Remove its duplicate as parameters should be unique.
self.parse_args(ctx, args)
/Users/amonshiz/.local/share/uv/tools/ttok/lib/python3.13/site-packages/click/core.py:1002: UserWarning: The parameter --tokens is used more than once. Remove its duplicate as parameters should be unique.
pieces = self.collect_usage_pieces(ctx)
/Users/amonshiz/.local/share/uv/tools/ttok/lib/python3.13/site-packages/click/core.py:1104: UserWarning: The parameter --tokens is used more than once. Remove its duplicate as parameters should be unique.
self.format_options(ctx, formatter)
Usage: ttok [OPTIONS] [PROMPT]...
Count and truncate text based on tokens
To count tokens for text passed as arguments:
ttok one two three
To count tokens from stdin:
cat input.txt | ttok
To truncate to 100 tokens:
cat input.txt | ttok -t 100
To truncate to 100 tokens using the gpt2 model:
cat input.txt | ttok -t 100 -m gpt2
To view token integers:
cat input.txt | ttok --encode
To convert tokens back to text:
ttok 9906 1917 --decode
To see the details of the tokens:
ttok "hello world" --tokens
Outputs:
[b'hello', b' world']
Options:
--version Show the version and exit.
-i, --input FILENAME
-t, --truncate INTEGER Truncate to this many tokens
-m, --model TEXT Which model to use
--encode, --tokens Output token integers
--decode Convert token integers to text
--tokens Output full tokens
--allow-special Do not error on special tokens
--help Show this message and exit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.